class BudgetMember {
  List<Member> members;

  BudgetMember({this.members});

  BudgetMember.fromJson(Map<String, dynamic> json) {
    if (json['members'] != null) {
      members = new List<Member>();
      json['members'].forEach((v) {
        members.add(new Member.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.members != null) {
      data['members'] = this.members.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Member {
  String role;
  String firstName;
  String lastName;
  double totalAssignedAmt;
  double totalSpent;
  double availableAmt;
  int budgetId;
  int memberId;
  List<Card> cards;
  bool companyOwner;

  Member(
      {this.role,
      this.firstName,
      this.lastName,
      this.totalAssignedAmt,
      this.totalSpent,
      this.availableAmt,
      this.budgetId,
      this.memberId,
      this.cards,
      this.companyOwner});

  Member.fromJson(Map<String, dynamic> json) {
    role = json['role'];
    firstName = json['firstName'];
    lastName = json['lastName'];
    totalAssignedAmt = json['totalAssignedAmt'];
    totalSpent = json['totalSpent'];
    availableAmt = json['availableAmt'];
    budgetId = json['budgetId'];
    memberId = json['memberId'];
    if (json['cards'] != null) {
      cards = new List<Card>();
      json['cards'].forEach((v) {
        cards.add(new Card.fromJson(v));
      });
    }
    companyOwner = json['companyOwner'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['role'] = this.role;
    data['firstName'] = this.firstName;
    data['lastName'] = this.lastName;
    data['totalAssignedAmt'] = this.totalAssignedAmt;
    data['totalSpent'] = this.totalSpent;
    data['availableAmt'] = this.availableAmt;
    data['budgetId'] = this.budgetId;
    data['memberId'] = this.memberId;
    if (this.cards != null) {
      data['cards'] = this.cards.map((v) => v.toJson()).toList();
    }
    data['companyOwner'] = this.companyOwner;
    return data;
  }
}

class Card {
  String id;
  int bmcId;
  int memberId;
  String role;
  String urole;
  String firstName;
  String lastName;
  int cardId;
  String cardType;
  double cardAssignedAmt;
  String cardName;
  double spent;

  Card(
      {this.id,
      this.bmcId,
      this.memberId,
      this.role,
      this.urole,
      this.firstName,
      this.lastName,
      this.cardId,
      this.cardType,
      this.cardAssignedAmt,
      this.cardName,
      this.spent});

  Card.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    bmcId = json['bmcId'];
    memberId = json['memberId'];
    role = json['role'];
    urole = json['urole'];
    firstName = json['firstName'];
    lastName = json['lastName'];
    cardId = json['cardId'];
    cardType = json['cardType'];
    cardAssignedAmt = json['cardAssignedAmt'];
    cardName = json['cardName'];
    spent = json['spent'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['bmcId'] = this.bmcId;
    data['memberId'] = this.memberId;
    data['role'] = this.role;
    data['urole'] = this.urole;
    data['firstName'] = this.firstName;
    data['lastName'] = this.lastName;
    data['cardId'] = this.cardId;
    data['cardType'] = this.cardType;
    data['cardAssignedAmt'] = this.cardAssignedAmt;
    data['cardName'] = this.cardName;
    data['spent'] = this.spent;
    return data;
  }
}
